from django.db import models
from mptt.models import MPTTModel, TreeForeignKey

class MyTreeNode(MPTTModel):
    name = models.CharField(max_length=100)
    parent = TreeForeignKey('self', on_delete=models.CASCADE, null=True, blank=True, related_name='children')

    class MPTTMeta:
        order_insertion_by = ['name']  # 可选的字段，用于指定插入节点时的排序方式


class ApplyTemplate(MPTTModel):
    '''审批模板'''
    control_id = models.CharField(max_length=50,primary_key=True,verbose_name='控件ID')
    title = models.CharField(max_length=50,verbose_name='控件名称')
    is_product = models.BooleanField(verbose_name='是否为产品')
    parent = TreeForeignKey('self', on_delete=models.CASCADE, null=True, blank=True, related_name='children')


